package com.threefish.common.plugins.beetl;

import org.beetl.core.GroupTemplate;
import org.beetl.core.Template;
import org.beetl.ext.web.WebRenderExt;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author 黄川 huchuc@vip.qq.com
 * @date: 2018/9/10
 */
public class GlobalExt implements WebRenderExt {
    /**
     * 添加模版需要的全局变量
     *
     * @param template
     * @param gt
     * @param request
     * @param response
     */
    @Override
    public void modify(Template template, GroupTemplate gt, HttpServletRequest request, HttpServletResponse response) {
        template.binding("base", request.getContextPath());
        template.binding("productVersion", System.currentTimeMillis());
    }
}
